package com.sxt.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.sxt.commons.NettyProperties;
import com.sxt.netty.TCPServer;

import lombok.extern.slf4j.Slf4j;

/**
 * @模块目的/功能：注册并启动服务器端 
 * @版权说明： 
 * @版本号：1.0 
 * @日期：2019.11.13
 * @作者：罗林
 */

@Slf4j
@Configuration
public class NettyConfig {
	//注入参数
	@Autowired
	private NettyProperties nettyProperties;
	
	@Bean
	public TCPServer TCP_Server() {
		log.info("");
		//端口号
		Integer port = nettyProperties.getPort();
		//分隔符
		byte delimiter = 0x7e;
		TCPServer server = new TCPServer(port, delimiter);
        server.startServer();
        return server;
	}
}
